<style type="text/css">
    .table th, .table td {
        text-align: center;
        vertical-align: middle!important;
    }
    .table th:nth-child(1), 
    .table td:nth-child(1) 
    {
        width: 5%;
    } 
    .table th:nth-child(6), 
    .table td:nth-child(6) 
    {
        width: 8%;
    } 
    .table th:nth-child(2), 
    .table td:nth-child(2),
    .table th:nth-child(5), 
    .table td:nth-child(5)
    {
        width:15%;
    }
    .table th:nth-child(3), 
    .table td:nth-child(3)
    {
        width:20%;
    }
    .table th:nth-child(4), 
    .table td:nth-child(4)
    {
        width:37%;
    }
    .pagination li {
        display: inline;
        margin-left: 0.5em;
        margin-right: 0.5em;
    }
    .red {color: red;}
</style>
<div class="col-sm-8 col-sm-offset-2">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordion" href="#thongtindkt">
                    <span class="glyphicon glyphicon-pencil">&nbsp;</span>
                    Thông Tin Đoàn Kiểm Tra
                </a>
            </h4>
        </div>
        <div class="panel-collapse collapse in" id="thongtindkt">        
            {{ Form::open(array('url'=>'store=dsdoankt','method'=>'post','class'=>'form-horizontal','role'=>'form')) }} 
            {{ Form::token()}}
            <table class="table" cellspacing="0" cellpadding="0" style="margin-bottom: 0px">
                <tr>
                    <td>
                        <label for="madkt" class="col-sm-3 control-label">Mã đoàn kiểm tra:</label>
                        <div class="col-sm-9">
                            {{ Form::hidden('id',$row->ID)}}
                            {{ Form::hidden('sotv',$row->SO_TV_TG)}}
                            {{ Form::text('madkt',$row->MA_DOAN_TT,array('placeholder' => 'Nhập mã đoàn kiểm tra','class'=>'form-control','required'=>'','pattern'=>'[A-Za-z0-9]{5,20}')) }}
                        </div> 
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="tendkt" class="col-sm-3 control-label">Tên đoàn kiểm tra:</label>
                        <div class="col-sm-9">
                            {{ Form::text('tendkt',$row->TEN_DOAN_TT,array('placeholder' => 'Nhập tên đoàn kiểm tra','class'=>'form-control','required'=>'','pattern'=>'{1,100}')) }}
                        </div> 
                    </td>
                </tr>
                <tr>                      
                    <td>
                        <div class="col-sm-offset-2 col-sm-8"> 
                            <button class="btn btn-success" id='submitbtn' type='submit' title="Lưu thay đổi"><span class="glyphicon glyphicon-floppy-save">&nbsp;</span>Lưu</button>&nbsp;&nbsp;
                            <a class="btn btn-default" id="backcs_id" href="{{url('ql=dsdoankt')}}" title="Quay lại danh sách đoàn kiểm tra"><span class="glyphicon glyphicon-arrow-left">&nbsp;</span>Quay lại</a>
                        </div>
                    </td>
                </tr>
            </table>
            {{Form::close()}}
        </div>
    </div>
</div>

<div class="col-sm-10 col-sm-offset-1">
    <!-- Bắt đầu danh sách thành viên trong đoàn  -->
    <div class="panel panel-default" style="margin-top: 50px">
        <div class="panel-heading">
            <h4 class="panel-title">
                <a data-toggle="collapse" data-parent="#accordion" href="#thongtintv">
                    <span class="glyphicon glyphicon-folder-open">&nbsp;</span>
                    Thông Tin Thành Viên Trong Đoàn
                </a>
            </h4>
        </div>
        <div class="panel-collapse collapse in" id="thongtintv">
            <table class="table table-bordered table-hover">
                <thead>
                    <tr class="label-warning">
                        <th>STT</th>
                        <th>Mã cán bộ</th>
                        <th>Tên cán bộ</th>
                        <th>Chức vụ</th>
                        <th>Chức danh</th>
                        <th>Tác vụ</th>
                    </tr>
                </thead>
                <tbody>
                       <?php
                       $list = DB::table('vctdoantt')->where('ID_DOAN_TT', $row->ID)->get();
                       if($list != null) {
                           foreach($list as $ct){
                               echo '<tr>';
                               echo '<td>'.++$stt.'</td>';
                               echo '<td>'.$ct->MSCB.'</td>';
                               echo '<td>'.$ct->HO_TEN.'</td>';
                               echo '<td>'.$ct->TEN_CV.'</td>';
                               echo '<td>'.$ct->TEN_CD.'</td>';
                               ?>
                                <td><a href="{{url('view=editdtt?idct='.$ct->id)}}" id="{{$ct->id}}" class="details_dkt text-success"><i class="glyphicon glyphicon-search" title="Xem chi tiết thông tin cán bộ"></i></a>&nbsp;
                                <a href="{{url('delete=xoatv?id='.$ct->id.'&idd='.$ct->ID_DOAN_TT)}}" id="{{$ct->id}}" class="delete_dkt text-danger" title="Xóa thành viên"><i class="glyphicon glyphicon-remove"></i></a></td>
                        <?php
                            echo '</tr>';
                            }
                       }
                       ?>
                        @if($stt <= 0)
                        <tr>
                            <td colspan="8"><span class="red glyphicon glyphicon-warning-sign">&nbsp;</span>Không có thành viên nào trong đoàn.</td>
                        </tr>
                        @endif
                </tbody>
            </table>  
        </div>
    </div>
    <!-- Kết thúc danh sách thanh viên trong đoàn  -->
</div>

@if(Session::has('success')) 
<script type="text/javascript">
    toastr.success("{{Session::get('success')}}");
</script>
@endif
@if(Session::has('error')) 
<script type="text/javascript">
    toastr.error("{{Session::get('error')}}");
</script>
{{var_dump(Session::get('data'))}}
@endif